let lunarCalendar = Object.create(null);

let h = {
    value: ['甲', '乙', '丙', '丁', '戊', '己', '庚', '辛', '壬', '癸'],
    writable: false,
    enumerable: false,
    configurable: false
}
Object.defineProperty(lunarCalendar, 'heavenlyStems', h);
let e = {
    value: ['子', '丑', '寅', '卯', '辰', '巳', '午', '未', '申', '酉', '戌', '亥'],
    writable: false,
    enumerable: false,
    configurable: false
}
Object.defineProperty(lunarCalendar, 'earthlyBranches', e);
lunarCalendar.showYears = function() {
    let i = j = 0;
    let count = 0;
    let x, y;
    //求最小公倍数
    let LCM = 0;
    let product = this.heavenlyStems.length * this.earthlyBranches.length;
    LCM = product;
    for (let m = product - 1; m >= Math.max(this.heavenlyStems.length, this.earthlyBranches.length); m--) {
        if (m % this.heavenlyStems.length == 0 & m % this.earthlyBranches.length == 0) {
            LCM = m;
            break;
        }
    }
    //************************************************** */

    while (count < LCM) {
        i = count % this.heavenlyStems.length;
        x = this.heavenlyStems[i];
        j = count % this.earthlyBranches.length;
        y = this.earthlyBranches[j];
        process.stdout.write(x + y + " ");
        count++;
        if (count % 12 == 0) {
            console.log('\n');
        }
    }
}
lunarCalendar.showYears();